<template>
	<view>
		<view class="sign_top">
			<image src="../../../static/sigin_in/title.png" mode=""></image>
		</view>
		<view class="sign_center">
			<image src="../../../static/sigin_in/sigin_1.png" mode=""></image>
			<view class="sign_center_title">
				签 到 即 获 得 薪 聚 力 × {{list.award}}
			</view>
			<view class="sign_center_title_1">
				已连续签到
			</view>
			<view class="sign_center_title_2">
				{{list.continuation}}<text style="font-weight: normal;font-size: 26rpx;">天</text>
			</view>
			<view class="diandao_sigin">
				<view class="diandao_sigin_txt" v-for="(item,index) in list.dates" :key="index">
					<image src="/static/sigin_in/qiandao.png" mode="" v-if="item.state==1"></image>
					<image src="/static/sigin_in/weiqiandao.png" mode=""  v-if="item.state==0"></image>
					
					<text>{{item.name}}</text>
				</view>
				
			</view>
			<view class="sigin_button" @click="goqiandaowancheng" v-if="list.today==0">
				立即签到
			</view>
			<view class="sigin_button1"  v-else>
				今日已签到
			</view>
		</view>
	</view>
</template>

<script>
	import Require from '@/common/require.js';
	export default {
		data() {
			return {
				list:[]
			}
		},
		onShow() {
			var self=this
			self.get_url()
		},
		methods: {
			goqiandaowancheng(){
				var self=this
				self.qiandan()
			},
			get_url(){
				var self = this;
				Require.commonRequest({
					url: '/api/member/signdetail',
					success: function(ret) {
						if (ret.data.code == 200) {
							self.list=ret.data.data
						} else {
							uni.showToast({
			 					icon: 'none',
								title: ret.data.msg,
							});
						}
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			qiandan(){
				var self = this;
				Require.commonRequest({
					url: '/api/member/sign',
					data:{
						contribution:self.list.award
					},
					success: function(ret) {
						if (ret.data.code == 200) {
							self.get_url()
							uni.showToast({
								icon: 'success',
								title: ret.data.msg,
							});
							uni.navigateTo({
								url:'./Sign_in1?award='+self.list.award+'&continuation='+self.list.continuation,
							})
							
						} else {
							uni.showToast({
			 					icon: 'none',
								title: ret.data.msg,
							});
						}
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			
			
		}
	}
</script>

<style lang="less">
	page{
		background-color: #7322D8;
	}
	.sign_top{
		width: 750rpx;
		height: 150rpx;
		background-color: #7322D8;
		display: flex;
		align-items: center;
		justify-content: center;
		image{
			width: 520rpx;
			height: 46rpx;
		}
	}
	.sign_center{
		height: 970rpx;
		width: 750rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		image{
			width: 720rpx;
			height: 100%;
		}
		.sign_center_title{
			position: absolute;
			top:180rpx;
			font-size:38rpx;
			font-family:FZHei-B01S;
			font-weight:bold;
			color:rgba(46,46,46,1);
		}
		.sign_center_title_1{
			position: absolute;
			top:250rpx;
			font-size:28rpx;
			font-family:FZHei-B01S;
			color:#C2A058;
		}
		.sign_center_title_2{
			position: absolute;
			top:450rpx;
			font-size:30px;
			font-family:FZHei-B01S;
			font-weight:bold;
			color:rgba(49,49,49,1);
		}
		.sigin_button{
			width:630rpx;
			height:90rpx;
			background:rgba(115,34,216,1);
			box-shadow:0px 0px 18rpx 2rpx rgba(115,34,216,0.3);
			border-radius:20rpx;
			position: absolute;
			top: 830rpx;
			font-size:38rpx;
			font-family:PingFang SC;
			font-weight:bold;
			color:rgba(255,255,255,1);
			text-align: center;
			line-height: 90rpx;
		}
		.sigin_button1{
			width:630rpx;
			height:90rpx;
			background:#D2D1D0;
			box-shadow:0px 0px 18rpx 2rpx #D2D1D0;
			border-radius:20rpx;
			position: absolute;
			top: 830rpx;
			font-size:38rpx;
			font-family:PingFang SC;
			font-weight:bold;
			color:rgba(255,255,255,1);
			text-align: center;
			line-height: 90rpx;
		}
		.diandao_sigin{
			width: 630rpx;
			height: 120rpx;
			position: absolute;
			top: 650rpx;
			display: flex;
			justify-content: space-between;
			.diandao_sigin_txt{
				width: 71rpx;
				height: 120rpx;
				font-size: 24rpx;
				display: flex;
				flex-wrap: wrap;
				flex-direction: column;
				justify-content: space-between;
				text-align: center;
				image{
					width: 70rpx;
					height: 70rpx;
				}
			}
		}
	}
</style>
